<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>设备管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/equipment/eleEquipment/">设备列表</a></li>
		<li class="active">
            <a href="${ctx}/equipment/eleEquipment/form?id=${eleEquipment.id}">设备
                <shiro:hasPermission name="equipment:eleEquipment:edit">${not empty eleEquipment.id?'修改':'添加'}</shiro:hasPermission>
                <shiro:lacksPermission name="equipment:eleEquipment:edit">查看</shiro:lacksPermission>
            </a>
        </li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="eleEquipment" action="${ctx}/equipment/eleEquipment/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">设备ID：</label>
			<div class="controls">
				<form:input path="code" htmlEscape="false" maxlength="255" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">分公司：</label>
			<div class="controls">
                <shiro:hasRole name="admin">
                    <sys:treeselect id="company" name="company.id" value="${eleEquipment.company.id}" labelName="company.name"
                                    labelValue="${eleEquipment.company.name}"
                                    title="公司" url="/sys/office/treeData?type=1" cssClass="required" allowInput="false"/>
                    <span class="help-inline"><font color="red">*</font> </span>
                </shiro:hasRole>
                <shiro:lacksRole name="admin">
                    <input id="companyId" name="company.id" value="${eleEquipment.company.id}" type="hidden">
                    <input id="companyName" name="company.name" value="${eleEquipment.company.name}" type="hidden">
                    <label class="lbl">${eleEquipment.company.name}</label>
                </shiro:lacksRole>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">分组：</label>
			<div class="controls">
				<shiro:hasPermission name="equipment:eleEquipment:check">
					<sys:treeselect id="office" name="office.id" value="${eleEquipment.office.id}" labelName="office.name"
									labelValue="${eleEquipment.office.name}" title="部门"
									url="/sys/office/treeData?type=2" cssClass="required" notAllowSelectParent="false" allowInput="false"/>
					<span class="help-inline">
					<font color="red">*</font> </span>
				</shiro:hasPermission>
				<shiro:lacksPermission name="equipment:eleEquipment:check">
					<input id="companyId" name="company.id" value="${eleEquipment.office.id}" type="hidden">
					<input id="companyName" name="company.name" value="${eleEquipment.office.name}" type="hidden">
					<label class="lbl">${eleEquipment.office.name}</label>
				</shiro:lacksPermission>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">设备类型：</label>
			<div class="controls">
				<sys:treeselect id="type" name="type.id" value="${eleEquipment.type.id}"
								labelName="type.name" labelValue="${eleEquipment.type.name}"
								title="设备类型" url="/equipment/eleEquipmentType/treeData" cssClass="required"/>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">分辨率：</label>
			<div class="controls">
				<form:input path="width" htmlEscape="false" maxlength="255" class="input-mini digits" />
				*
				<form:input path="height" htmlEscape="false" maxlength="255" class="input-mini digits"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="input-xxlarge "/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="equipment:eleEquipment:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="下一步"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>